import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.0

Window {
    visible: true
    width: 1280
    height:1024
    title: qsTr("Hello World")
    x:500
    y:600

    onWidthChanged: {
        console.log("width:", width);
    }

    MyRectangle{
        x:0
        y:0
    }

    MyRectangle{
        x:220
        y:0
        id:root
        state:"nomal"
        states: [
            State {
                name: "nomal"
                PropertyChanges {

                }
            },
            State {
                name: "red_color"
                PropertyChanges {
                    target: root;
                    color:"red"
                    width:300
                }
            },
            State {
                name: "blue_color"
                PropertyChanges {
                    target: root;
                    color:"blue"
                    height:300
                }
            }
        ]

        MouseArea{
            anchors.fill:parent
            onPressed: {
                root.state = "red_color"
            }
            onReleased: {
                root.state = "blue_color"
            }
        }
    }



}
